﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Payton.WP7.Common.Model;
using Hammock;
using Hammock.Authentication.OAuth;

namespace Payton.WP7.Common.Tencent
{
    public class TencentOAuthService : OAuthServiceBase
    {

        public TencentOAuthService()
        {
            Provider = SNSProviderManager.Current.GetProvider(SNSProviderType.Tencent);
        }

        protected override Hammock.Authentication.IWebCredentials CreateCredentials(OAuthType type)
        {
            var credentials = base.CreateCredentials(type) as OAuthCredentials;

            
            if (credentials != null)
            {
                switch (type)
            {
                case OAuthType.RequestToken:
                    credentials.ParameterHandling = OAuthParameterHandling.UrlOrPostParameters;
                    credentials.CallbackUrl = "null";
                    break;
                case OAuthType.AccessToken:
                    credentials.ParameterHandling = OAuthParameterHandling.UrlOrPostParameters;
                    break;
                    default:
                    break;
            }
                
            }

            return credentials;
        }
    }
}
